$(document).ready(function() {
    var backBtn = $('<input type="button"/>');
    backBtn.addClass("adminButton");
    backBtn.val("Back");
    backBtn.css({"position":"absolute",
                "top" : "100px",
                "right":"10px"});
    $("#container").append(backBtn);
    
    backBtn.click(function() {
        window.location.replace("admin.jsp");
    });
    
    $("#delivery_btn").unbind('click').click(function() {
            sendData();
    });
    
    function sendData() {
        var dataString = 'id=' + $("#id_order").attr('value')
                    + '&comment=' + $("#area").val();
            $.ajax({
                type: "POST",
                url: "Courier",
                data: dataString,
                success:  function(data) {
                    if (data.answer === "OK") {
                        window.location.replace("admin.jsp");
                    } 
                }
            });
    };
});